package com.dzpk.facadeserver.manager;

import com.dzpk.facadeserver.util.Encrypt;

/**
 * Created by somnus on 16/8/22.
 */
public class Token {

    private int code;

    private long userId;

    private long time;

    private String server; // ip:port

    private String token;

    private boolean enter;

    public Token(long userId, String server) {
        this.userId = userId;
        this.server = server;
        this.time = System.currentTimeMillis();
        this.token = Encrypt.md5(userId + server + time);
    }

    public Token(int code) {
        this.code = code;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getServer() {
        return server;
    }

    public void setServer(String server) {
        this.server = server;
    }

    public boolean isEnter() {
        return enter;
    }

    public void setEnter(boolean enter) {
        this.enter = enter;
    }
}
